<%@page import="com.windfone.common.Constant"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="head.jsp"%>
<%@ taglib uri="/WEB-INF/recommend.tld" prefix="windfone"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>风驰电讯  您最贴心的手机顾问  用户登录或注册</title>
<%@ include file="headkey.jsp"%>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script>

function checkName(){
	var loginName = $("#loginName2").val();  
	if ( loginName !=""){
	$.ajax({  
	    type:"post",  
	    url:"<%=contextPath%>/checkLoginName.action",  
	    data:{loginName:loginName},  
     	success: function(msg){
	    	if ( msg == true )
		    	document.getElementById("msg").innerHTML = "<font color=red>已有该用户</font>";
		    else
		    	document.getElementById("msg").innerHTML = "<font color=green>可以使用该账号</font>";
			    	
	 	} 
	});
	}
}

function checkonSubmit2(){
	if ( $("#loginName2").val() ==""){
		alert("用户登录名不允许为空");
		$("#loginName2").focus();
		return false;
	} 
	if ( $("#password2").val() ==""){
		alert("密码不允许为空");
		$("#password").focus();
		return false;
	} 
	if ( $("#confpassword2").val() ==""){
		alert("确认密码不允许为空");
		$("#confpassword").focus();
		return false;
	} 
	if ( $("#confpassword2").val() != $("#password2").val()){
		alert("两次密码不正确");
		$("#password2").focus();
		return false;
	} 
	
	if ( $("#email").val() ==""){
		alert("邮箱不允许为空");
		
		return false;
	} else {
		var email = $("#email").val();
		var reg = /^([a-zA-Z0-9_-]||[\.])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
	    if (reg.test(email) == false ) {
	    	alert("请输入正确的邮件地址!");
	    	$("#email").focus();
	    	return false;
	    }
	}
	var loginName = $("#loginName2").val();  
	$.ajax({  
	    type:"post",  
	    url:"<%=contextPath%>/checkLoginName.action",  
	    data:{loginName:loginName},  
     	success: function(msg){
	    	if ( msg == false )
	    		document.getElementById("userRegistFrm").submit();
	 	} 
	});
}
function checkonSubmit(){
	if ( $("#loginName").val() ==""){
		alert("用户登录名不允许为空");
		$("#loginName").focus();
		return false;
	} 
	if ( $("#password").val() ==""){
		alert("密码不允许为空");
		$("#password").focus();
		return false;
	} 
	var userLoginFrm = document.getElementById("userLoginFrm");
	userLoginFrm.submit();
}
</script>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>

<body id="pages9">

<!--头部-->
<%@ include file="navigate.jsp"%>
<!--内容-->
<div class="contentBox"><!--左区-->
<div class="col2" style="width: 990px">
<div class="tabLeBoxB" style="padding-top: 0">
	<div class="title"><h3>购物车</h3></div>
	<div class="borderBox">
		<div><img src="images/sopping2.gif" width="934" height="81" /></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="50%">
				<form method="post" action="orderLogin.action" name="userLoginFrm" id="userLoginFrm">
				<table width="300" border="0" align="center" cellpadding="0" cellspacing="0" style="margin: 0 auto; margin-top: 30px;">
					<tr>
						<td>用户</td>
						<td><input type="text" name="loginName" id="loginName"  tabindex="1"/></td>
						<td rowspan="2">
							<input type="button" name="button" id="button" value="登录" tabindex="3" onclick="checkonSubmit();return false;" /></td>
					</tr>
					<tr>
						<td>密码</td>
						<td><input type="password" name="password" id="password"  tabindex="2"/></td>
					</tr>
				</table>
				</form>
				</td>
				<td>
				<table width="100%" align="center">
						<tr>
							<td align="center">
							<s:form id="userRegistFrm" name="userRegistFrm" action="orderRegisterUser"  method="post">
								<table width="100%" >
									<tr>
									<td>登录名称</td>
									<td align="left">&nbsp;<input name="loginName" maxlength="20" id="loginName2" onblur="checkName()"  style="width: 200px;" type="text"/>
											 <input type="hidden" id="checkNameHidden" value="false" name="checkNameHidden" /> 
											 <span id="msg"></span>
											 <br/><br/>
											 您的用户名直可以包含：字母、数字、下划线
											 </td></tr>
									<tr><td>登录密码</td><td align="left">&nbsp;<input type="password" style="width: 200px;" id="password2" maxlength="50" name="password" />
									 <br/><br/>6-12
										位，可以使用：字母、数字、符号</td></tr>
									<tr><td>确认密码</td><td align="left">&nbsp;<input type="password" style="width: 200px;" id="confpassword2" maxlength="50" name="confpassword" /></td></tr>
									<tr><td>邮箱地址</td><td  align="left">&nbsp;<input type="text" style="width: 200px;" id="email" maxlength="100" name="email" />
										<br/><br/>
										请正确输入您的电子邮件，以便接收商城信息，以及找回您的密码
									</td></tr>
									<tr><td colspan="2"><font color="green"><s:property value='rtvMsg'/></font></td></tr>
							 		<tr>
							 <td colspan="2"> 
							 <!-- src="images/reg_btnreg.png" -->
							 <s:token></s:token>
								<input type="button" name="button" id="button" value="完成注册" style="border-width: 0px;" onclick="checkonSubmit2()" />
							</td>
						</tr>
								</table>
								</s:form>
							<%--
									<s:form id="userRegistFrm" name="userRegistFrm" action="orderRegisterUser"  method="post">
									<div align="center">
									<ul class="oper_list">
										<li class="item" id="LNameTitle">登录名称</li>
										<li class="item">
											<input name="loginName" maxlength="20" id="loginName2" onblur="checkName()"  style="width: 200px;" type="text"/>
											 <input type="hidden" id="checkNameHidden" value="false" name="checkNameHidden" /> 
											 <span id="msg"></span>
										</li>
										<li class="item_err" id="LNameMsg"></li>
										<li class="title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您的用户名直可以包含：字母、数字、下划线</li>
									</ul>
									<ul class="oper_list">
										<li class="item" id="LPWDTitle">登录密码</li>
										<li class="item">
											<input type="password" style="width: 200px;" id="password2" maxlength="50" name="password" />
										</li>
										<li class="item_err" id="LPWDMsg"></li>
										<li class="title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6-12
										位，可以使用：字母、数字、符号</li>
									</ul>
									<ul class="oper_list">
										<li class="item" id="LRPWDTitle">确认密码</li>
										<li class="item">
											<input type="password" style="width: 200px;" id="confpassword2" maxlength="50" name="confpassword" />
										</li>
										<li class="item_err" id="LRPWDMsg"></li>
										<li class="title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;重新输入登录密码</li>
									</ul>
									<ul class="oper_list">
										<s:token></s:token>
										<li class="item" id="UEmailTitle">邮箱地址</li>
										<li class="item">
											<input type="text" style="width: 200px;" id="email" maxlength="100" name="email" />
										</li>
										<li class="item_err" id="UEmailMsg"></li>
										<li class="title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请正确输入您的电子邮件，以便接收商城信息，以及找回您的密码</li>
									</ul>
									<ul class="oper_list">
										<li class="item">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="green"><s:property value='rtvMsg'/></font></li>
									</ul>
									</div>
								</s:form>
								 --%>
							</td>
						</tr>
				</table>
				</td>
			</tr>
		</table>
		<div class="clear"></div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
   <%@ include file="bottom.jsp" %>
</body>
</html>
